package Demo8.Run;

public class Mythread1 implements Runnable{

    int num=0;//共享的

    @Override
    public void run() {
        //运行状态

//        new Scanner(System.in).next();//-----------阻塞状态
        for (int i = 0; i < 10; i++) {//-------------阻塞解除,进入就绪状态
            if(Thread.currentThread().getName().equals("线程1")) {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
                System.out.println("我是线程:" + Thread.currentThread().getName() + "----" + "当前num的值" + (num++));

        }
    }
}
